-- Script n°002: "member" table.

BEGIN;

-- Sequence on member id.
DROP SEQUENCE IF EXISTS seq_member;

CREATE SEQUENCE seq_member
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

ALTER TABLE seq_member OWNER TO chelioudbdev;
GRANT ALL ON TABLE seq_member TO chelioudbdev;
GRANT SELECT, UPDATE ON TABLE seq_member TO cheliouwebdev;

-- Member table.

DROP TABLE IF EXISTS member;

CREATE TABLE member (
   ID                   NUMERIC              NOT NULL DEFAULT nextval('seq_member'::regclass),
   LOGIN                VARCHAR(50)          NOT NULL,
   PASSWORD             TEXT                 NOT NULL,
   NAME                 VARCHAR(50)          NOT NULL,
   FIRSTNAME            VARCHAR(50)          NOT NULL,
   EMAIL                VARCHAR(100)         NOT NULL,
   ROLES                VARCHAR(255)         NOT NULL,
   LOCALE               VARCHAR(100)         NOT NULL,
   CONSTRAINT pk_member PRIMARY KEY (ID)
)WITH (
  OIDS=FALSE
);

ALTER TABLE member OWNER TO chelioudbdev;
GRANT ALL ON TABLE member TO chelioudbdev;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE member TO cheliouwebdev;

COMMIT;